-
-
Notifications
You must be signed in to change notification settings - Fork 42
London | 25-SDC-Nov | Jesus del Moral | Sprint 5| Prep Exercises #295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
4cc7c30 to
294b028
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good work on these tasks, there are some areas where you could improve further
Also,consider if it is a good idea to have all these files in the main directory for this sprint
| # - Methods support inheritance | ||
| # - Better organization | ||
| # - Better organization | ||
| # - Methods enable polymorphism |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good answers!
generics.py
Outdated
| def print_family_tree(person: Person) -> None: | ||
| print(person.name) | ||
| for child in person.children: | ||
| print(f"- {child.name} ({child.age})") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this print grandchildren recursively?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made print_family_tree recursive, so it prints children, grandchildren, great-grandchildren...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to change the validation to allow for reentry if the input was invalid, rather than exiting immediately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have modify the code, crating a while loop, each input is wrapped in a while True loop. Only break from the loop when a valid value is entered. Invalid entries print an error to stderr but don’t exit, so the user can retry.
01aed45 to
40a13c5
Compare
Preparation exercise from Sprint5